﻿function $try(){for(var B=0,A=arguments.length;
B<A;B++){try{return arguments[B]();}catch(C){}}return null;}

$try(function(){document.execCommand("BackgroundImageCache",false,true);});

if(typeof(window['rdModuleIns'])=='undefined'||!window['rdModuleIns']) window['rdModuleIns'] = [];
function initResuadmiModule(){
	var e=/<[^>]+\srdmodule=[\'\"]?([\w|]+)[^>]+/g;
	var g=/id=[\'\"]?([\w\-]+)/i;
	var i,j,rIndex=-1;
	window.document.body.innerHTML.replace(e,function(a,b){if((i=a.match(g))&&(j=document.getElementById(i[1]))){
																if(window[b]){
																	var x,y,z;
																	if(b=='resumePhotoFac_popdiv'){
																		if(!window[b+'_popupDiv']) window[b+'_popupDiv'] = buildRePhotoDiv();
																		if(window['showPopup']) window['rdModuleIns'][i[1]] = new window[b](j);
																		else{
																			y = i[1];
																			z = j;
																			$loadJs('/s/js/erd2/popupDiv_shim.js','utf-8',function(){window['rdModuleIns'][y] = new window[b](z);})
																		}
																	}
																	else if(b=='resumeMoreInfoFac'){
																		if(!window['resumeListItemIns']) window['resumeListItemIns'] = new Array();
																		rIndex++;
																		x = rIndex;
																		if(window['submitCallback']) window['resumeListItemIns'][x] = window['rdModuleIns'][i[1]] = new window[b](j,x);
																		else{
																			y = i[1];
																			z = j;
																			$loadJs('/s/js/ajaxbase.js','utf-8',function(){window['resumeListItemIns'][x] = window['rdModuleIns'][y] = new window[b](z,x);})
																		}
																	}
																	else window['rdModuleIns'][i[1]] = new window[b](j);
																}
															}
															return '';
										});
}

function resumePhotoFac(h){
	var s = this;
	s.html = h;
	s.html.title = '有照片';
	s.photoSrc = s.html.getAttribute('photosrc')||'';
	s.srcPrefix = 'http://my.zhaopin.com';
	s.id = s.html.id.toString().split('_')[1];
	var img = document.createElement('img');
	img.src = '/s/images/erd2/icon_loadingani.gif';
	img.className = 'photoImgLoading';
	s.img = img;
}

function buildRePhotoDiv(){
	var div = document.createElement('div');
	div.id = '$photoPopupDiv';
	div.className = 'photoPopupDiv';
	div.setAttribute('photoId','');
	var img = document.createElement('img');
	img.src = '/s/images/erd2/icon_loadingani.gif';
	img.className = 'photoImgLoading';
	myAttachEvent(img,'load',function(e){var myEve = window.event?window.event:e;var img = myEve.target?myEve.target:myEve.srcElement;if(img.src.toString().toLowerCase().indexOf('icon_loadingani.gif')>-1) img.className='photoImgLoading';else img.className='photoImg';});
	div.appendChild(img);
	div.img = img;
	document.body.appendChild(div);
	return div;
}
function resumePhotoFac_popdiv(h){
	var s = this;
	s.html = h;
	s.photoSrc = s.html.getAttribute('photosrc')||'';
	s.srcPrefix = 'http://my.zhaopin.com';
	s.id = s.html.id.toString().split('_')[1];
	if(!window['resumePhotoFac_popupDiv']) window['resumePhotoFac_popupDiv'] = buildRePhotoDiv();
	s.div = window['resumePhotoFac_popupDiv'];
	s.fOver = function(e){s.fnShowPhoto(e);};
	s.fOut = function(e){s.fnHidePhoto(e);};
	myAttachEvent(s.html,'mouseover',s.fOver);
	myAttachEvent(s.html,'mouseout',s.fOut);
}
resumePhotoFac_popdiv.prototype = {
	fnShowPhoto : function(e){
		var s = this;
		if(s.div.photoId!=s.id){
			var pointer = getXY(s.html);
			var x = pointer.x + s.html.offsetWidth;
			var y = pointer.y + s.html.offsetHeight;
			showPopup(s.div.id,e,x,y);
			s.div.img.src = s.srcPrefix + s.photoSrc;
			//s.div.img.className = 'photoImg';
			s.div.photoId = s.id;
		}
		else return;
	},
	fnHidePhoto : function(e){
		var s = this;
		s.div.photoId = '';
		hideCurrentPopup();
		s.div.img.src = '/s/images/erd2/icon_loadingani.gif';
		//s.div.img.className = 'photoImgLoading';
	}
}

function movetofavoriate_one(str){
	openPopup('','movetofavorite',450,200);
    document.form1.select_unique_id.value = str;
    delete_ids = str;
    document.form1.action = "/s/resuadmi/ResumeMoveToFavorite.asp?need_refresh=none";
    document.form1.target = "movetofavorite";
    document.form1.submit();
    document.form1.action = "";
    document.form1.target = "";
}
function forwardResume_one(str){
	openPopup('','FWResume',360,150);
    document.form1.select_unique_id.value = str;
    document.form1.action = "/s/resuadmi/FWResume.asp";
    document.form1.target = "FWResume";
    document.form1.submit();
    document.form1.action = "";
    document.form1.target = "";
}
function buttonShowGen(o){
	var button = document.createElement('input');
	button.type = 'button';
	button.className = 'lineButton';
	button.value = '显示简历';
	var resumeId = o.resumeId;
	myAttachEvent(button,'click',function(){viewOneResume(resumeId)});
	return button;
}
function buttonSaveGen(o){
	var button = document.createElement('input');
	button.type = 'button';
	button.className = 'lineButton';
	button.value = '收藏到简历夹';
	button.style.width = '95px';
	var resumeId = o.resumeId;
	myAttachEvent(button,'click',function(){movetofavoriate_one(resumeId)});
	return button;
}
function buttonSendGen(o){
	var button = document.createElement('input');
	button.type = 'button';
	button.className = 'lineButton';
	button.value = '简历导出';
	var resumeId = o.resumeId;
	myAttachEvent(button,'click',function(){forwardResume_one(resumeId)});
	return button;
}
function changeBgMouseover(o){
	o.className = o.className.replace('list1','list3').replace('list2','list3');
}
function changeBgMouseout(o){
	o.className = o.className.replace('list3',o.origClass);
}
function resuadmiListHTMLGen(o,flag,goon){
	var tr = document.createElement('tr');
	tr.className = o.html.origClass||o.html.className;
	tr.origClass = tr.className;
	tr.onmouseover = function(){changeBgMouseover(this);changeBgMouseover(this.previousSibling);};
	tr.onmouseout = function(){changeBgMouseout(this);changeBgMouseout(this.previousSibling);};
	//myAttachEvent(tr,'mouseover',function(e){var myEve = e?e:window.event;var obj = myEve.target?myEve.target:myEve.srcElement;obj.className=obj.className.replace('list1','list3').replace('list2','list3');});
	//myAttachEvent(tr,'mouseout',function(e){var myEve = e?e:window.event;var obj = myEve.target?myEve.target:myEve.srcElement;obj.className=obj.className.replace('list3',obj.origClass);});
	var td;
	if(!o.htmlClassFnPro||!o.htmlClassFnPro.noBoxTd){
		td = document.createElement('td');
		td.appendChild(document.createTextNode(' '))
		td.className = 'tdCheckbox';
		tr.appendChild(td);
	}
	td = document.createElement('td');
	td.className = 'listMore';
	td.appendChild(document.createTextNode(' '));
	if(window['RD_RESUMELABEL']&&window['RD_RESUMELABEL'].allHTML.length) td.setAttribute("colSpan","2");
	td.setAttribute("vAlign","top");
	tr.appendChild(td);
	
	/* display photo in td */
	o.tdPhoto = td;
	
	td = document.createElement('td');
	td.className = 'listMore';
	td.style.width = (window['RD_RESUMELABEL']&&window['RD_RESUMELABEL'].allHTML.length)?'760px':'450px';//807
	if(o.htmlClassFnPro&&o.htmlClassFnPro.col) td.setAttribute('colSpan',o.htmlClassFnPro.col);
	else td.setAttribute('colSpan',8);//9
	var div = document.createElement('div');
	div.className = 'moreInfoLoading';
	o.divLoading = div;
	td.appendChild(div);
	var div = document.createElement('div');
	var div2 = document.createElement('div');
	o.divAjax = div2;
	div.appendChild(div2);
	o.buttonShow = buttonShowGen(o);
	div.appendChild(o.buttonShow);
	o.buttonSave = buttonSaveGen(o);
	div.appendChild(o.buttonSave);
	o.buttonSend = buttonSendGen(o);
	div.appendChild(o.buttonSend);
	o.divInfo = div;
	o.divInfo.style.display = 'none';
	td.appendChild(div);
	tr.appendChild(td);
	if(o.html.nextSibling) o.html.parentNode.insertBefore(tr,o.html.nextSibling);
	else o.html.parentNode.appendChild(tr);
	o.moreTr = tr;
	o.moreTr.style.display = 'none';
	o.flagDisplay = 'hide';
	o.showhideMoreInfo(flag,goon);
}
function resumeMoreInfoFac(h,index){
	var s = this;
	s.html = h;
	s.html.onmouseover = function(){changeBgMouseover(this);if(window['rdModuleIns'][this.id]&&window['rdModuleIns'][this.id].moreTr) changeBgMouseover(window['rdModuleIns'][this.id].moreTr);};
	s.html.onmouseout = function(){changeBgMouseout(this);if(window['rdModuleIns'][this.id]&&window['rdModuleIns'][this.id].moreTr) changeBgMouseout(window['rdModuleIns'][this.id].moreTr);};
	s.index = index;
	s.resumeId = s.html.id.toString().split('_')[1];
	s.resumeNum = s.html.getAttribute('resume_number')||'';
	s.resumeBH = s.html.getAttribute('resume_bh')||'';
	s.expItems = s.html.getAttribute('expItems')||null;
	if(s.expItems==null||isNaN(s.expItems)) s.expItems = 1;
	s.htmlClass = s.html.getAttribute('htmlClass')||'resuadmiListHTMLGen';
	s.htmlClassFn = s.htmlClass.toString().split('|')[0];
	s.htmlClassFnProStr = s.htmlClass.toString().split('|')[1]||null;
	if(s.htmlClassFnProStr!=null) eval('s.htmlClassFnPro = ' + s.htmlClassFnProStr);
	else s.htmlClassFnPro = null;
	s.moreInfoStr = null;
	s.flagInsertInfo = false;
	s.ajaxState = 'ok';
	s.C = function(e){s.fnClick(e);};
	myAttachEvent(s.html,'click',s.C);
}
resumeMoreInfoFac.prototype = {
	fnClick : function(e){
		function clickFnOkObj(o){
			/* display photo in td */
			return o.nodeType==1&&(o.tagName.toLowerCase()=='td'||(o.tagName.toLowerCase()=='img'&&o.getAttribute('rdmodule')&&o.getAttribute('rdmodule')=='resumePhotoFac'))
		}
		
		var s = this;
		var myEve = e?e:window.event;
		var target = myEve.target?myEve.target:myEve.srcElement;
		if(clickFnOkObj(target)) s.fnShowHide();
		else return;
	},
	fnShowHide : function(flag,goon){
		var s = this;
		if(!s.moreTr) window[s.htmlClassFn](s,flag,goon);
		else s.showhideMoreInfo(flag,goon);
	},
	showhideMoreInfo : function(flag,goon){
		var s = this;
		if(flag){
			if(flag=='show') s.showMoreInfo(goon);
			else if(flag=='hide') s.hideMoreInfo();
		}
		else{
			if(s.flagDisplay=='hide') s.showMoreInfo(goon);
			else s.hideMoreInfo();
		}
	},
	showMoreInfo : function(goon){
		var s = this;
		if(s.deadFlag){
			if(typeof(goon)!='undefined'&&goon) setTimeout('goonShowReDetail()',0);
			return;
		}
		if(!s.flagInsertInfo){
			if(s.divLoading.style.display=='none') s.divLoading.style.display = '';
			if(s.divInfo.style.display!='none') s.divInfo.style.display = 'none';
		}
		
		/* display photo in td */
		if(window['rdModuleIns']['photo_'+s.resumeId]&&!s.objPhoto){
			s.objPhoto = window['rdModuleIns']['photo_'+s.resumeId];
			if(s.tdPhoto.childNodes[0]) s.tdPhoto.removeChild(s.tdPhoto.childNodes[0]);
			s.tdPhoto.appendChild(s.objPhoto.img);
			myAttachEvent(s.objPhoto.img,'load',function(e){var myEve = window.event?window.event:e;var img = myEve.target?myEve.target:myEve.srcElement;if(img.src.toString().toLowerCase().indexOf('icon_loadingani.gif')>-1) img.className='photoImgLoading';else img.className='photoImg';});
			s.objPhoto.img.src = s.objPhoto.srcPrefix + s.objPhoto.photoSrc;
		}
		
		s.moreTr.style.display = '';
		if(s.html.className.indexOf('list3')>-1) changeBgMouseover(s.moreTr);
		s.flagDisplay = 'show';
		if(s.moreInfoStr==null) s.ajaxGetInfo(goon);//goto AJAX  if(goon) alert(window['resumeDetailProIndex']);
		else{
			if(!s.flagInsertInfo) s.insertAjaxHTML(goon);
			else{
				if(typeof(goon)!='undefined'&&goon) setTimeout('goonShowReDetail()',0);
			}
			if(s.divLoading.style.display!='none') s.divLoading.style.display = 'none';
			if(s.divInfo.style.display=='none') s.divInfo.style.display = '';
		}
	},
	hideMoreInfo : function(){
		var s = this;
		s.moreTr.style.display = 'none';
		s.flagDisplay = 'hide';
	},
	insertAjaxHTML : function(goon){
		var s = this;
		var str = '<p><b>自我评价：</b>'+s.moreInfo.comm+'</p><p><b>最近工作：</b>';
		var i,workItem;
		for(i=0;s.moreInfo.work[i];i++){
			workItem = s.moreInfo.work[i];
			str += workItem[0]+'&nbsp;&nbsp;'+workItem[1]+'&nbsp;&nbsp;'+workItem[2]+'<br>'+workItem[3]+'<br>';
		}
		str += '</p>';//if(goon) alert(s.divAjax.innerHTML);
		s.divAjax.innerHTML = str;
		s.flagInsertInfo = true;
		if(typeof(goon)!='undefined'&&goon) setTimeout('goonShowReDetail()',0);
	},
	ajaxGetInfo : function(goon){
		var s = this;
		if(s.ajaxState=='ajax') return;
		var data = 'ext_id='+s.resumeBH+'&showint='+s.expItems+'&version_num='+s.resumeNum;// + '&t='+new Date().getTime();
		//var data = 'showint=3&ext_id=JR009025817R90250001000&version_num=5' + '&t='+new Date().getTime();
		s.ajaxState = 'ajax';
		submitCallback(data,'/s/resume_preview/resume_preview_summy.asp',handleGetMoreInfoResponse,'get',{o:s,goon:goon});
		//test(data,'xxx.asp',handleGetMoreInfoResponse,'get',s);
	}
}
function test(a,b,c,d,e){
	c(true,"{comm:'自我评价',work:[['时间','公司名称','职位名称','描&acute;//述'],['时间','公司名称','职位名称','描述']]}",e);
}
function handleGetMoreInfoResponse(success,responseText,objPar){
	objPar.o.ajaxState = 'ok';
	if(success){
		objPar.o.moreInfoStr = responseText;//document.form1.GotoPageNum.value = objPar.o.moreInfoStr
		//alert(objPar.o.moreInfoStr)
		try{eval('objPar.o.moreInfo = '+objPar.o.moreInfoStr);}
		catch(e){};//if(objPar.goon) alert(objPar.o.moreInfo&&objPar.o.flagDisplay=='show');
		if(objPar.o.moreInfo&&objPar.o.flagDisplay=='show') objPar.o.showMoreInfo(objPar.goon);
	}
	else{//ajax error
		objPar.o.divAjax.innerHTML = 'ajax 出错！';
		if(objPar.o.divLoading.style.display!='none') objPar.o.divLoading.style.display = 'none';
		if(objPar.o.divInfo.style.display=='none') objPar.o.divInfo.style.display = '';
	}
}

function goonShowReDetail(){
	if(window['resumeDetailProFlag']){
		var index = ++window['resumeDetailProIndex'];
		var obj = window['resumeListItemIns'][index];
		while(obj){
			if(obj.ajaxState!='ajax'){
				obj.fnShowHide('show',true);
				break;
			}
			else{
				if(obj.flagDisplay=='hide'){
					if(obj.divLoading.style.display=='none') obj.divLoading.style.display = '';
					if(obj.divInfo.style.display!='none') obj.divInfo.style.display = 'none';
					obj.moreTr.style.display = '';
					obj.flagDisplay = 'show';
				}
				index = ++window['resumeDetailProIndex'];
				obj = window['resumeListItemIns'][index];
			}
		}
	}
}
function reDetailSimpleFac(h){
	var s = this;
	s.html = h;
	s.state = s.html.getAttribute('defaultState')||'simple';
	s.triggerImgs = s.html.getElementsByTagName('img');
	s.trigger2simple = s.triggerImgs[0]||null;
	s.trigger2detail = s.triggerImgs[1]||null;
	s.fnS = function(e){s.fnSimpleShow(e);};
	s.fnD = function(e){s.fnDetailShow(e);};
	if(s.trigger2simple) s.trigger2simple.title = s.trigger2simple.alt = '简单列表';
	if(s.trigger2detail) s.trigger2detail.title = s.trigger2simple.alt = '详细列表';
	s.fnBlank = function(){return;};
	s.setTrigger();
}
reDetailSimpleFac.prototype = {
	fnSimpleShow : function(){
		var s = this;
		var allResumeIns = window['resumeListItemIns'];
		window['resumeDetailProFlag'] = false;
		if(allResumeIns && allResumeIns.length)
		if(s.state=='detail'){
			s.state = 'simple';
			s.setTrigger();
			s.fnHideAllDetail(allResumeIns);
		}
		else if(s.state=='simple') return;
	},
	fnDetailShow : function(){
		var s = this;
		var allResumeIns = window['resumeListItemIns'];
		window['resumeDetailProFlag'] = true;
		if(allResumeIns && allResumeIns.length)
		if(s.state=='simple'){
			s.state = 'detail';
			s.setTrigger();
			s.fnShowAllDetail(allResumeIns);
		}
		else if(s.state=='detail') return;
	},
	fnShowAllDetail : function(arr){
		var s = this;
		window['resumeDetailProIndex'] = 0;
		if(arr[window['resumeDetailProIndex']]) arr[window['resumeDetailProIndex']].fnShowHide('show',true);
	},
	fnHideAllDetail : function(arr){
		var s = this;
		for(var i=0;arr[i];i++) if(arr[i].flagDisplay=='show') arr[i].hideMoreInfo();
	},
	setTrigger : function(){
		var s = this;
		switch(s.state){
			case 'simple' : if(s.trigger2simple){
							s.trigger2simple.className = 'iconReList_simple_sel';
							s.trigger2simple.onclick = s.fnBlank;
						}
						if(s.trigger2detail){
							s.trigger2detail.className = 'iconReList_detail';
							s.trigger2detail.onclick = s.fnD;
						}
						break;
			case 'detail' : if(s.trigger2simple){
							s.trigger2simple.className = 'iconReList_simple';
							s.trigger2simple.onclick = s.fnS;
						}
						if(s.trigger2detail){
							s.trigger2detail.className = 'iconReList_detail_sel';
							s.trigger2detail.onclick = s.fnBlank;
						}
						break;
		}
	}
}

$regEventDomReady(initResuadmiModule);

function $loadJs(a,b,c){var d=arguments.callee;var e=d.queue||(d.queue={});b=b||(((window.document.charset?window.document.charset:window.document.characterSet)||"").match(/^(gb2312|big5|utf-8)$/gi)||"utf-8").toString().toLowerCase();if(a in e){if(c){if(e[a]) e[a].push(c);else c();}return;}e[a]=c?[c]:[];var f=window.document.createElement("script");f.type="text/javascript";f.charset=b;f.onload=f.onreadystatechange=function(){if(f.readyState&&f.readyState!="loaded"&&f.readyState!="complete") return;f.onreadystatechange=f.onload=null;	while(e[a].length) e[a].shift()();e[a]=null};f.src=a;window.document.getElementsByTagName("head")[0].appendChild(f)};